package be.colwri.server;

import java.util.Vector;

import be.colwri.client.CPResult;
import be.colwri.client.ColwriService;
import be.colwri.client.Command;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;



@SuppressWarnings("serial")
public class ColwriServiceImpl extends RemoteServiceServlet implements ColwriService{
    
	CommandProcessor cp = new CommandProcessor();
	
	
	public CPResult getString (Vector<Command> commandar, int lastnumber) {
	 	System.out.println("Processing...");
	    CPResult cpr;
		if ((commandar !=null) && (!commandar.isEmpty())){
		
			int test = cp.addCommands(commandar, lastnumber);			
		/*	for (i = 0; i < commandar.size(); i++) {
				zin = zin + commandar.get(i).getTyped() + commandar.get(i).getPosition() + " ";
			}*/
			cpr = new CPResult (cp.getResult(), test);
	   
		}
		else {
			
			cpr = new CPResult (cp.getResult(), cp.getSize());
		}
		  return cpr;
	}	
}
